import reshandler from 'services/response-handler'
/*
 * 获取评论
 */
function makeData(response) {
  let commentsArr = []
  response.comments&&response.comments.forEach(val=>{
    val.member['name'] = val.member.nickname
    val.member['publishDate'] = val.commentDatetime || '1'
    commentsArr.push(val)
  })
  return commentsArr
}
export default function (params, success, fail) {
  // request 
  params = Object.assign({}, params, {
    methodName: "ListSpaceComment",
  })

  // invoke
  this.$.get(params)
    .then(reshandler.success(success, fail, makeData), reshandler.error(fail))
}